﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
    public partial class Login : System.Web.UI.Page
    {
        SQLHelper helper = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string name = TextBox1.Text;
            string password = TextBox2.Text;
            string sql = "select * from StudentInfo where stu_nama=@name AND password =@password ";
            SqlParameter[] pars =
                {
            new SqlParameter("name",name),
            new SqlParameter("password",password),
            };
            DataSet d = helper.Get(sql, pars);
            if (d.Tables.Count!=0)
            {
                Literal1.Text = "登录成功!";
            }
            else
            {
                Literal1.Text = "账号或密码错误!";

            }

        }
    }
}